package com.alks.function.controller.finance.costcheck;

import com.alks.common.aop.ApiRestController;
import com.alks.common.aop.WebLogger;
import com.alks.entity.data.entity.PcSlipDetailPartBf2;
import com.alks.entity.data.response.ResponseInfo;
import com.alks.function.data.dto.finance.costcheck.PcPackDetailsReq;
import com.alks.function.service.pcfactoryquery.IPcSlipDetailPartBfService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/**
 * @author:hxl
 * @create: 2024-06-07 16:14
 * @Description: 耗品收获检核
 */
@ApiRestController("/consumable")
@Api(tags = "耗品收货检核")
public class PcConsumableController {
    //材料入库查询

    @Autowired
    private IPcSlipDetailPartBfService partBfService;

    @PostMapping("/getConsumableList")
    @WebLogger
    @ApiOperation(value = "材料入库查询",tags = "耗品收货检核")
    public ResponseInfo getConsumableList(@RequestBody PcPackDetailsReq req){
        return partBfService.getConsumableList(req);
    }

    @PostMapping("/optionConsumable")
    @WebLogger
    @ApiOperation(value = "打勾记录检核、备注确认",tags = "耗品收货检核")
    public ResponseInfo optionConsumable(@RequestBody List<PcSlipDetailPartBf2> list,
                                         @ApiParam(value = "1:打勾检核2：打勾取消检核 3：备注确认") @RequestParam String choose,
                                         @ApiParam(value = "choose为3传 备注") @RequestParam(required = false) String remark){
        return partBfService.optionConsumable(list,remark,choose);
    }

    @GetMapping("/getConsumableDetail")
    @WebLogger
    @ApiOperation(value = "入库明细",tags = "耗品收货检核")
    public ResponseInfo getConsumableDetail(@RequestParam String slipNo){
        return partBfService.getConsumableDetail(slipNo);
    }

    //耗品取单价
    @PostMapping("/setUnitPrice")
    @WebLogger
    @ApiOperation(value = "取单价",tags = "耗品收货检核")
    public  ResponseInfo setUnitPrice(@RequestBody List<PcSlipDetailPartBf2> list){
        return partBfService.setUnitPrice(list);
    }

    @PostMapping("/saveConsumableDetail")
    @WebLogger
    @ApiOperation(value = "保存",tags = "耗品收货检核")
    public ResponseInfo saveConsumableDetail(@RequestBody List<PcSlipDetailPartBf2> list){
        return partBfService.saveConsumableDetail(list);
    }
}
